import request from '@/utils/request';
import { AxiosResponse } from 'axios';
import { pageQuery, inspectionrouteForm } from '@/api/inspection/inspectionroute/types';
type RES = Promise<AxiosResponse>;
/**
 * 查询巡检路线
 * @param query
 * @returns {*}
 */

export const ApiGetInspectionRouteList = (query?: pageQuery): RES => {
  return request({
    url: '/inspection/route/list',
    method: 'get',
    params: query
  });
};

/**
 * 创建巡检接路线接口
 *
 * @param params 巡检路由表单参数（可选）
 * @returns 返回 RES 类型的结果
 */
export const ApiCreateInspectionRoute = (params?: inspectionrouteForm): RES => {
  return request({
    url: '/inspection/route',
    method: 'post',
    data: params
  });
};

/**
 * 更新巡检路线信息API
 *
 * @param params 巡检路线表单数据，可选
 * @returns 返回RES类型的结果
 */
export const ApiUpdateInspectionRoute = (params?: inspectionrouteForm): RES => {
  return request({
    url: '/inspection/route',
    method: 'put',
    data: params
  });
};

/**
 * 获取巡检路线详情
 *
 * @param query 查询参数，可选
 * @returns 返回API请求结果
 */
export const ApiGetInspectionRouteDetail = (id?: string | number): RES => {
  return request({
    url: '/inspection/route/' + id,
    method: 'get'
  });
};

/**
 * 删除巡检路线
 *
 * @param query 查询参数，可选
 * @returns 返回API请求结果
 */
export const ApiDeleteInspectionRoute = (id?: string | number): RES => {
  return request({
    url: '/inspection/route/' + id,
    method: 'delete'
  });
};

/**
 * 巡检路线-巡检点迁移接口
 * @param params 查询参数，可选
 */
export const ApiMoveInspectionRoute = (params?: any): RES => {
  return request({
    url: 'inspection/route/transfer',
    method: 'put',
    data: params
  });
};
